package cn.jiangjiesheng.bootstrap.fileport.demo;

import cn.jiangjiesheng.bootstrap.filestore.FileStoreClient;
import lombok.var;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.util.ResourceUtils;

import java.io.FileInputStream;
import java.io.FileNotFoundException;

/**
 * Created by dev@jiangjiesheng.cn on 2021/3/22  <br/>
 * @author jerrylau
 */
@SpringBootTest(classes = DemoApplication.class)
public class MinioFileStoreExample {

    @Autowired
    private FileStoreClient fileStoreClient;

    @Test
    void getObject(){
        fileStoreClient.getObject("test");
    }

    @Test
    void putObject() throws FileNotFoundException {
        fileStoreClient.putObject("yzetvonydk661.jpg",
                new FileInputStream(ResourceUtils.getFile("classpath:img.png"))
        );
    }

    @Test
    void getObjectMeta() {
        String key = "yzetvonydk661.jpg";
        var t = fileStoreClient.getObjectMeta(key);
        System.out.println(t);
        Assertions.assertNotNull(t);
    }


    @Test
    void testGeneratePreSignedURL() {
        System.out.println(fileStoreClient.generatePreSignedURL("yzetvonydk661.jpg"));
    }

    @Test
    void initializeClient() {
    }

    @Test
    void putBigObject() {
    }

    @Test
    void testPutBigObject() {
    }

    @Test
    void publicRead() {
        fileStoreClient.publicRead("test","test",true);
    }

    @Test
    void copyObject() {
    }

    @Test
    void doesBucketExists() {
    }

    @Test
    void createBucket() {
    }

    @Test
    void deleteObject() {
    }

    @Test
    void deleteMultipleObjects() {
    }

    @Test
    void doesObjectsExists() {
    }

    @Test
    void doesObjectExists() {
    }

    @Test
    void generatePreSignedURL() {
    }

    @Test
    void testGeneratePreSignedURL1() {
    }

    @Test
    void testDeleteObject() {
    }

    @Test
    void testDeleteMultipleObjects() {
    }

    @Test
    void testDoesObjectsExists() {
    }

    @Test
    void testDoesObjectExists() {
    }

    @Test
    void testGeneratePreSignedURL2() {
    }

    @Test
    void testGeneratePreSignedURL3() {
    }

    @Test
    void testGeneratePreSignedURL4() {
    }

    @Test
    void close() {
    }
}
